<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:sijyp="http://java.sun.com/jsf/composite/sijyp"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	
	<rich:dataTable 
		id="obligacionesTable" 
		var="record_"
		style="width: 100%"
		value="#{obligacionesManager.dataModel}" 
		rows="10"
		noDataLabel="${msg['general.registrosNoEncontrados']}">

		<ui:include src="/resources/sijyp/jpaColumn.xhtml">
			<ui:param name="bean" value="#{obligacionesManager}" />
			<ui:param name="propertyTitle"
				value="bienes.situacion.obligacionesTable.idBien" />
			<ui:param name="explicitProperty" value="#{record_.bien.idBien}" />
			<ui:param name="propertyFilter" value="bien.idBien" />
			<ui:param name="componentRender" value="obligacionesTable" />
			<ui:param name="hideColumn" value="true" />
		</ui:include>

	
		<ui:include src="/resources/sijyp/jpaColumn.xhtml">
			<ui:param name="bean" value="#{obligacionesManager}" />
			<ui:param name="propertyTitle"
				value="bienes.situacion.obligacionesTable.concepto" />
			<ui:param name="explicitProperty"
				value="#{record_.tpConceptoObligacion.nombre}" />
			<ui:param name="propertyFilter" value="tpConceptoObligacion.nombre" />
			<ui:param name="componentRender" value="obligacionesTable" />
		</ui:include>

		<ui:include src="/resources/sijyp/jpaColumn.xhtml">
			<ui:param name="bean" value="#{obligacionesManager}" />
			<ui:param name="propertyTitle"
				value="bienes.situacion.obligacionesTable.fechaFacturacion" />
			<ui:param name="explicitProperty" value="#{record_.fchObligacion}" />
			<ui:param name="propertyFilter" value="obligacion.fchObligacion" />
			<ui:param name="componentRender" value="obligacionesTable" />
			<ui:param name="fecha" value="true" />
		</ui:include>

		<ui:include src="/resources/sijyp/jpaColumn.xhtml">
			<ui:param name="bean" value="#{serviciosDomiciliariosManager}" />
			<ui:param name="propertyTitle"
				value="bienes.situacion.obligacionesTable.valorDeuda" />
			<ui:param name="explicitProperty" value="#{record_.valorTotal}" />
			<ui:param name="propertyFilter" value="obligacion.valorTotal" />
			<ui:param name="componentRender" value="obligacionesTable" />
			<ui:param name="currency" value="true" />
			<ui:param name="explicitPropertyCurrencyType"
				value="#{record_.intereses.tpMoneda}" />
		</ui:include>

		<rich:column>
			<f:facet name="header">
				<h:commandLink value="${msg['bienes.tablaCaracteristicas.accion']}">
					<f:ajax execute="@none" />
				</h:commandLink>
			</f:facet>
			<h:panelGrid columns="3"
				columnClasses="icon_space,icon_space,icon_space">

				<h:commandLink action="#{obligacionesManager.prepareUpdate}"
					rendered="#{!obligacionesManager.consulta and !bienManager.reading and !bienManager.disableSubtabsEditAction}">
					<h:graphicImage value="/resources/images/icons/ico_pencil.png"
						title="${msg['boton.editar']}" />
					<f:setPropertyActionListener
						target="#{obligacionesManager.obligacion}" value="#{record_}" />
					<f:setPropertyActionListener
						target="#{obligacionesManager.consulta}" value="false" />
					<f:setPropertyActionListener
						target="#{obligacionesManager.edicion}" value="false" />
					<f:ajax execute="@this"
						render=":formTabs:contenedorObligaciones :sijypMessages" />
				</h:commandLink>

				<h:graphicImage value="/resources/images/icons/ico_pencil_gray.png"
					title="${msg['boton.editar']}"
					rendered="#{bienManager.disableSubtabsEditAction}" />

				<h:commandLink action="#{obligacionesManager.prepareRead}">
					<h:graphicImage value="/resources/images/icons/ico_details.png"
						title="${msg['boton.consultar']}" />
					<f:setPropertyActionListener
						target="#{obligacionesManager.obligacion}" value="#{record_}" />
					<f:setPropertyActionListener
						target="#{obligacionesManager.consulta}" value="true" />
					<f:setPropertyActionListener
						target="#{obligacionesManager.edicion}" value="false" />
					<f:ajax execute="@this"
						render=":formTabs:contenedorObligaciones :sijypMessages" />
				</h:commandLink>

				<a4j:commandLink value="" execute="@this" render="@none"
					rendered="#{!obligacionesManager.consulta and !bienManager.reading and !bienManager.disableSubtabsDeleteAction}"
					oncomplete="#{rich:component('confirmDeleteObligacion')}.show()">
					<h:graphicImage value="/resources/images/icons/ico_delete.png"
						title="${msg['boton.eliminar']}" />
					<a4j:param assignTo="#{obligacionesManager.idObligacion}"
						value="#{record_.id}" />
				</a4j:commandLink>

				<h:graphicImage
					value="/resources/images/icons/ico_delete_disabled.png"
					title="${msg['boton.eliminar']}"
					rendered="#{bienManager.disableSubtabsDeleteAction}" />
			</h:panelGrid>
		</rich:column>
		
		<f:facet name="footer">
			<rich:dataScroller maxPages="10" fastStep="5" fastControls="hide" stepControls="show" />
		</f:facet>
	</rich:dataTable>

	<sijyp:confirmDialog message="${msg['general.confirmaBorrar']}"
		confirmId="confirmDeleteObligacion"
		renderComponents=":sijypMessages :formTabs:contenedorObligaciones"
		acceptAction="#{obligacionesManager.deleteObligacionBien()}" />

</ui:composition>
